<template>
<div style="position: relative;height: 100%;background: #F5F5F5;">
	<div class="bang_zhu" @click="tiaozhuan">
		<div class="bang_tu"><img src="static/question.png"></div>
		
		<div class="bang_ji">积分规则</div>
		
		<div class="bang_tu1"><img src="static/arrow_right_gray.png"></div>
		
	</div>
	<div style="width: 100%; height: 10px;background-color: #eee;"></div>
	<div style="width: 100%;height: 40px;background: white;border-bottom: 1px solid #EEEEEE;">
		<!--<div class="wbzd">我帮助的</div>
		<div class="bawd">帮助我的</div>-->
		<tab>
	      <tab-item selected @on-item-click="onItemClick(0)">我的帮助</tab-item>
	      <tab-item @on-item-click="onItemClick(1)">帮助我的</tab-item>
	    </tab>
	</div>
	<div class="py_hd" v-show="xianshi">
		<div class="py_hdn">您通过助力朋友获得</div>
		<div class="py_hdj">{{num}}积分</div>
		<div class="clearfix"></div>
	</div>
	<div class="py_hd" v-show="!xianshi">
		<div class="py_hdn">您通过朋友助力获得</div>
		<div class="py_hdj">{{num}}积分</div>
		<div class="clearfix"></div>
	</div>
	  	<div class="meiren" v-for="value in bangzhu">
	  		<img :src=value.userInfo.headimg />
	  		{{value.userInfo.nickname}}
	  		<span class="jiu_sha">{{value.count}}次</span>
	  		<!--<div class="meiren1">没有人先生</div>-->
	  		<!--<div class="meiren2">14:23</div>-->
	  	</div>
	  	<div v-show="isshow" style="width: 100%;margin-top: 80px;"><p style="font-size: 14px;line-height: 30px;text-align: center;">暂无记录</p></div>
	  	<loading :show="show1" :text="text1"></loading>
</div>
</template>

<script>
import { Tab, TabItem  } from 'vux'
import axios from 'axios'
import { mapState, mapActions } from 'vuex'

export default {
  components: {
    Tab,
    TabItem,
    mapState,
    mapActions
  },
  data () {
    return {
    	bangzhu:[],
    	isshow:false,
    	num:'',
    	show1:false,
  		text1:'loading...',
  		xianshi:true,
    }
  },
  methods: {
  	beginget(){
  		this.show1 = true;
  		axios.post(this.url + '/home/User/help',{openid:this.token}).then((res)=>{
		  		console.log(res);
		  		this.show1 = false;
		  		if(res.data.bangzhu.length == 0){
		    		this.isshow = true;
		    	}else{
		    		this.bangzhu = res.data.bangzhu;
		    		this.num = res.data.num;
		    	}
	  	})
  	},
    onItemClick (index){
    	if(index == 0){
    		this.xianshi = true;
			this.beginget();
    	}
    	if(index == 1){
    		this.xianshi = false;
    		axios.post(this.url + '/home/User/helpme',{openid:this.token}).then((res)=>{
		  		console.log(res);
		  		if(res.data.bangzhu.length == 0){
		    		this.isshow = true;
		    	}else{
		    		this.bangzhu = res.data.bangzhu;
		    		this.num = res.data.num;
		    	}
		  	})
    	}
    },
    tiaozhuan(){
    	this.$router.push('/jifenguize');
    }
  },
  created(){
  	this.beginget();
  },
  computed:{
	      ...mapState({
	          token: state => state.Token.userToken()//获取用户Token
	      }),
	  }
}
</script>

<style scoped>
	
	
	*{
		/*box-sizing: border-box;*/
	}
	body{
		position: relative;
	}
	.weui-cell{
		padding: 0px 15px;
	}
	input{
		margin: 0;
		padding: 0;
		display: block;
		outline: none;
	}
	.tjdd_footer{
		width: 100%;
		height: 50px;
		position: fixed;
		bottom: 0;
		background: #FFFFFF;
		/*border: 1px solid red;
		box-sizing: border-box;*/
	}
	.heji_jine{
		float: right;
		height: 50px;
		line-height: 50px;
		font-family: "微软雅黑";
		color: #DF3033;
		font-size: 14px;
		padding-right: 3px;
		font-size: 14px;
		background-color: #FFFFFF;
	}
	.heji_text{
		float: right;
		height: 50px;
		line-height: 50px;
		color: #333333;
		background-color: #FFFFFF;
		font-size: 14px;
		
		
	}
	.tjdd_btn{
		width: 30%;
		float: right;
		/*border: 1px solid black;
		box-sizing: border-box;*/
		height: 50px;
		background-color: black;
	}
	.tjdd_btn input{
		width: 100%;
		line-height: 50px;
		background-color: #00C850;
		color: #fff;
		font-size: 16px;
		outline: none;
		border:none ;
	}
	.heji_zuo{
		width: 70%;
		height: 50px;
		float: left;
		background-color: #FFFFFF;
		/*border: 1px solid blue;
		box-sizing: border-box;*/
	}
	.sp_xj{
		margin-right: 16px;
	}
	.spxj{
		float:right;
		color: #333333;
		font-size: 15px;
	}
	.xj_jine{
		float: right;
		color: #DF3033;
		font-size: 15px;
		font-family: "微软雅黑";
	}
	.weui-cells {
    background-color: #FFFFFF;
    line-height: 1.41176471;
    font-size: 14px;
    overflow: hidden;
    position: relative;
}
	.clearfix{
		clear: both;
	}
	.cz_number{
		border-bottom: 1px solid #E5E5E5;
		width: 92%;
		margin: 0 auto;
	}
	.chongzhihaoma{
		width: 20%;
		margin: 14px 0;
		font-size: 16px;
		float: left;
	}
	.shuru{
		padding: 0 5px;
		height: 25px;
		width: calc(80% - 10px);
		font-size: 16px;
		margin: 14px 0;
		float: left;
	}
	.dizhi{
		width: 100%;
		margin: 0 auto;
		padding: 0 15px;
		height: 78px;
	}
	
	img,input{
		display: block;
	}
	
	.qr_xx{
		width: 80%;
		
		float: left;
		margin-top: 20px;
		/*margin-left: 10px;*/
		
	}
	.shr{
		color: #333333;
		font-size: 14px;
		float: left;
		margin-top: -10px;
		line-height: 14px;
	}
	.sh_dz{
		color: #9B9B9B;
		font-size: 13px;
		line-height: 17px;
		margin-top: -20px;
		
	}
	.sh_dh{
		float: left;
		margin-left: 10px;
		color: #333333;
		font-size: 14px;
		line-height: 14px;
		margin-top: -10px;
		
	}
	
	.dz_line{
		width: 100%;
		height: 2px;
	}
	.dz_line img{
		display: block;
		height: 2px;
		width: 100%;
		margin-top: -20px;
	}
	.zgydgfqjd{
		width: 100%;
		font-size: 12px;
		color: #333333;
		margin: 10px 0;
	}
	.zg_wenzi{
		margin: 11px 0px 10px 16px;
	}
	.spxq_spnr{
		width: 100%;
		height: 78px;
		padding: 15px 0;
		/*border: 1px solid red;*/
		background-color: #fafafa;
		
	}
	.sp_xtp{
		width: 78px;
		height: 78px;
		/*border: 1px red solid;*/
		margin-left: 15px;
		float: left;
	}
	.sp_xtp img{
		width: 100%;
		display: block;
	}
	.spnr_wenzi{
		height: 78px;
		float: right;
		background-color: #FAFAFA;
		box-sizing: border-box;
		/*border: 1px solid black;*/
		position: relative;
		width: calc(100% - 108px);
		padding-right: 27px;
	}
	.spnr_text{
		font-size: 14px;
		color: #333333;
		background-color: #FAFAFA;
	}
	.sp_jt_jg{
		font-size: 16px;
		color: #DF3033;
		background-color: #FAFAFA;
	}
	.jine{
		float: left;
		font-family: "微软雅黑"
	}
	.shuliang{
		float: right;
		color: #333333;
		font-size: 12px;
		position: absolute;
		bottom: 0;
		right: 27px;
	}
	input::-webkit-input-placeholder{
		color: #949494;
		font-size: 16px;
	}
	.content1{
		width: 100%;
		border: 1px /*solid*/ red;
		color: white;
		/*border: 1px solid red;*/
	}
	
.zl{
		width: 100%;
		text-align: center;
		line-height: 20px;
		font-size: 16px;
		margin-top: 15px;
		color: #333;
	}
.gzjf{width: 100%;
		text-align: center;
		line-height: 17px;
		font-size: 13px;
		color: #7f7f7f;
		margin-top: 10px;
		padding: 0 15px;
		
	}
.lan{
		width: 100%;
		border: 1px /*solid*/ green;
		margin-top: 20px;
	}
.yq{margin: 0 auto;
		width: 100%;
		height: 44px;
		background-color: #00c850;
		color: #FFFFFF;
		line-height: 22px;
	}
.lan1{
		float: left;
		width: 100%;
		border: 1px /*solid */green;
		
		line-height: 13px;
		font-size: 13px;
		color: #333;
		margin-left: 301px;
		margin-bottom: 20px;
	}
.yq1{
		padding: 0 20px;
		width: 100%;
		height: 44px;
		background-color: white;
		color: #00C850;
		line-height: 22px;
	}
	
*{list-style: none;margin: 0;padding: 0;}
.pq li{color: #333;
	       float: left;
	       line-height: 20px;
	       font-size: 14px;
	       margin-top: 10PX;
}
.pq .tu{height: 24px;
		width: 24px;
		border-radius: 50%;
		border: 1px /*solid*/ black;
		margin: 0 3px;
		margin-top: 8PX;
		}

.pq .pqz{float: right;
		color: #7f7f7f;
		line-height: 14px;
	    font-size: 13px;
	    /*margin-top: 13PX;*/
		}
.er_er{float: right;
		color: #333;
		line-height: 18px;
	    font-size: 16px;
	    margin-top: 6px;
}
.j_f{float: right;
		color: #333;
		line-height: 17px;
	    font-size: 12px;
	    margin-top: 6px;
		
}	
.you_fei{float: right;
		color: #333;
		line-height: 17px;
	    font-size: 12px;
		margin-top: 6px;
}	
.wenzi{margin-left: 80px;
		float: right;
		box-sizing: border-box;
		border: /*solid*/ yellow 1px;
		margin-top: -75px;
		
		}
.di{margin: 0;
			box-sizing: border-box;
			border: /*solid*/ 1PX slateblue;
			padding: 0 15px;
			}
.hyzl{float: right;
		background: #9b9b9b;
		height: 12px;
		width: 12px;
		margin-top: 5px;
		}
.ds_pqgz{margin-top: 6px;
			font-size: 12px;
			color: #333;
			float: right;
			line-height: 17px;
			}

.clearfix{float: none;
	clear: both;
	}

.tu1_box1{
	border: 1px solid red;
	border-bottom: 1px solid red;
	border: 1px /*solid*/ black;
	padding: 12px 0px;
	background: white;
	
}	
.ji_fenk1{
	border-bottom: 1px solid #EEEEEE;
	padding: 10px 10px;
	border: 1px /*solid*/ red;
	padding: 0 15px;
	background: white;
}
.jifenshangcheng{
	float: left;
	line-height: 20px;
	font-size: 14px;
	margin-left: 10px;
	margin-top: 10px
}
.yifahuo{
	float: right;
	line-height: 20px;
	font-size: 14px;
	color: #FF2E22;
	margin-top: 10px;
	margin-right: -7px;
	
	
	
}

.tu1_tu11{
	border: 1px /*solid*/ red;
	margin-top: 0px;
	padding: 0 15px;
}
.cheng_1{
	float: right;
	margin-top: 10px;
	line-height: 13px;
	font-size: 13PX;
	color: #4A4A4A;
}
.yu_fei{
	width: 100%;
	height: 44px;
	padding: 0 15px;
	border-top: 1px solid #EEEEEE;
	
}
.yun_fei{
	float: left;
	line-height: 20px;
	font-size: 14px;
	color: #333333;
	margin-top: 12px;
}
.ji_fen{
	float: right;
	line-height: 20px;
	font-size: 14px;
	color: #333333;
	margin-top: 12px;
}
.sanqi{
	float: right;
	line-height: 20px;
	font-size: 14px;
	color: red;
	margin-top: 12px;
}
.gongyi{
	float: right;
	line-height: 20px;
	font-size: 14px;
	color: #333333;
	margin-top: 12px;
}
.tuan_kuang{
		width: 180px;
		height: 100px;
		background:rgba(0,0,0,0.5);
		position: absolute;top:50%;
		left:50%;
		margin-left: -90px;
		margin-top: -50px;
		border-radius: 5px;
}
.fu_hao{
	height: 30px;
	width: 30px;
	margin: 0 auto;
	margin-top: 20px;
}
.fu_hao img{
	display: block;
	width: 100%;
}
.man_jifen{
	font-size: 13px;
	margin-top: 14px;
	text-align: center;
	color: #FFFFFF;
}
.jie_shu{
	float: right;
	font-size: 13px;
	color: #F8AF2C;
	margin-top: 9px;
}
.shishi{
	float: left;
	margin-left: 10px;
	line-height: 50px;
	font-size: 14px;
	color: #333333;
}
.y_i{
	float: left;
	
	line-height: 50px;
	font-size: 16px;
	color: #FF2E22;
}
.lu_kuang{
	height: 40px;
	width: 100%;
	background: #00c850;
	padding: 10px 15px;
}
.lu_kuangw{
	color: #FFFFFF;
	font-size: 16px;
	width: 49;
	height: 22px;
	line-height: 22px;
}
.di_san{
	height: 40px;
	width: 100%;
	border-bottom: 1px solid #EEEEEE;
	padding: 10px 10px;
	background: white;
}
.di_sanm{
	line-height: 20px;
	font-size: 14px;
	color: #333333;
	float: left;
}
.di_sanmm{
	line-height: 20px;
	font-size: 14px;
	color: #7F7F7F;
	float: right;
}
.liuliu{
	line-height: 20px;
	color: #333333;
	font-size: 14px;
}
.di_san1{
	height: 40px;
	width: 100%;
	border-bottom: 1px solid #EEEEEE;
	padding: 10px 8px;
	background: white;
}
.meiren{
	width: 100%;
	height: 60px;
	background: white;
	border-bottom: 1px solid #EEEEEE;
	padding: 18px 15px;
	color: #333333;
	font-size: 14px;
}
.meiren img{
	float: left;
	width: 36px;
	height: 36px;
	margin-top: -5px;
	margin-right: 10px;
}
.meiren1{
	line-height: 20px;
	float: left;
	font-size: 14px;
	margin-left: 10px;
}
.meiren2{
	float: right;
	line-height: 20px;
	font-size: 13px;
	color: #9B9B9B;
}
.jiu_sha{
	float: right;
	line-height: 20px;
	font-size: 13px;
	color: #333333;
}
.bang_zhu{
	width: 100%;
	height: 40px;
	background:white;
	padding: 10px 15px;
}
.bang_tu{
	float: left;
	height: 20px;
	width: 20px;
}
.bang_ji{
	line-height: 20px;
	font-size: 14px;
	color: #333333;
	float: left;
	margin-left: 5px;
}
.bang_tu1{
	float: right;
	width: 20px;
	height: 20px;
	margin-top: 5px;
}
.py_hd{
	width: 100%;
	height: 40px;
	padding: 11px 10px;
	background: white;
	border-bottom: 1px solid #EEEEEE;
}
.py_hdn{
	line-height: 18px;
	float: left;
	font-size: 13px;
	color: #4A4A4A;
}
.py_hdj{
	line-height: 18px;
	float: left;
	font-size: 13px;
	color: #FF2E22;
	margin-left: 5px;
	
}
.clearfix{
	float: none;
	clear: none;
}
.wbzd{
	float: left;
	line-height: 20px;
	font-size: 15px;
	color: #00c850;
}
.bawd{
	float: right;
	line-height: 20px;
	font-size: 15px;
	color: #4A4A4A;
}
</style>
